<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="com.tjsinfo.tjsoa.workTask.vo.TDailyWorkTask"%>
<%@page import="java.text.SimpleDateFormat;"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
	SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");		
	TDailyWorkTask tdwt = (TDailyWorkTask) request.getAttribute("tdwt");
	String method = (String) request.getAttribute("method");
	Integer currentStatus = tdwt.getCurrentStatus();
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>粮油集团办公自动化协作平台</title>
		<link href="<%=basePath%>style/txlz7.css" rel="stylesheet" type="text/css" />
		<link href="<%=basePath%>ajaxFramework/ext-2.1/resources/css/ext-all.css" rel="stylesheet" type="text/css" />
		<script type="text/javascript" src="<%=basePath%>ajaxFramework/ext-2.1/adapter/ext/ext-base.js"></script>
		<script type="text/javascript" src="<%=basePath%>ajaxFramework/ext-2.1/ext-all.js"></script>
		<script type="text/javascript" src="<%=basePath%>ajaxFramework/ext-2.1/source/locale/ext-lang-zh_CN.js"></script>
		<script type="text/javascript" src="<%=basePath %>ajaxFramework/jQuery/jquery.js"></script>
		<script type="text/javascript" src="<%=basePath %>js/common/global/validator.js"></script>
		<script type="text/javascript" src="<%=basePath %>js/common/global/pageControl.js"></script>
		<script type="text/javascript" src="<%=basePath %>js/common/system/selectusercheck.js"></script>
		
		<script type="text/javascript">
			var i =0
			$(function(){
				$.ajaxSetup({
				  async: false
				  }); 
				$("input[name='eee']").change(turn);
				$("#s0 a").attr("href","javascript:formsubmit(2)");
				$("#s1 a").attr("href","javascript:formsubmit(3)");
				$("#s2 a").attr("href","javascript:formsubmit(6)");
				$("#s4 a").attr("href","javascript:formsubmit(5)");
				$("#s5 a").attr("href","javascript:formsubmit(4)");
				$("#s6 a").attr("href","javascript:formsubmit(7)");
				$("#s7 a").attr("href","javascript:back('<%=method%>')");
				$("#s8 a").attr("href","javascript:formsubmit(8)");
			});
			function back(method){
				window.location.href="<%=basePath%>daily/workTask/workTaskList.jsp?dividerUserid="+method;
			}
				
			function formsubmit(currentStatus){
			    document.getElementById('status').value=currentStatus;
			    if(currentStatus==2){
					if(isnull("textarea[name='recipientFeedback']","办结情况不能为空")){
					   msg();
					   $("form[name='form0']").submit();
					}
			    }
			    if(currentStatus==3){
					if(isnull("textarea[name='recipientFeedback']","办结情况不能为空")){
					   //form0.setAttribute('action','<%=basePath%>daily/workTask/workTaskList.jsp?dividerUserid=dividerUserid');
					   msg();
					   $("form[name='form0']").submit();
					}
			    }
			    if(currentStatus==4){
					msg();
					$("form[name='form0']").submit();
			    }
			    if(currentStatus==5){
					msg();
					$("form[name='form0']").submit();
			    }
			    if(currentStatus==6){
			    	$('#turn').show();
			    	$('#s8').show();
			    	$('#s2').hide();
			    }
			    if(currentStatus==7){
			       if(confirm('你真得要删除数据吗?\r删除后不能恢复.\r请慎重操作.')){
				      msg();
				      window.location.href="<%=basePath%>tjsinfo/tjsoa/workTask/workTaskDel.do?id=<%=tdwt.getId()%>";
				   }
			    }
				if(currentStatus==8){
				   if(isnull("input[name='recipientUsername']","接受人不能为空")){
				      $("form[name='form0']").attr('action','<%=basePath%>tjsinfo/tjsoa/workTask/workTaskAdd.do?id=<%=tdwt.getId()%>');
				      msg();
				      $("form[name='form0']").submit();	
				   }			
				}
			}
			
			function test(){
			    initselectusercheck();    
			    document.getElementById('right').style.height = document.body.clientHeight-10;
			}
	    </script>
		<style>
			#right .contabwd_02 {
				width: 99%;
				margin-top: 6px;
				border: 1px #9DB0BC solid;
				background: #fff;
				height: 99%;
				float: left;
			}
		</style>
	</head>

	<body onload="test();">
	    <form action="<%=basePath%>tjsinfo/tjsoa/workTask/workTaskUpdate.do?id=<%=tdwt.getId()%>" method="post" name="form0" id="form0">
			<div id="right">
				<div class="p_01">
					<ul>
					<%if("recipientUserid".equals(method)){ %>
					   <%if(currentStatus.equals(1)||currentStatus.equals(4)){ %>
						<li id="s0" class="s09">
							<a href="#">办结</a>
						</li>
						<li id="s1" class="s09">
							<a href="#">拒绝</a>
						</li>
						<li id="s2" class="s09">
							<a href="#">转发</a>
						</li>
						<li id="s8" class="s09" style="display: none" >
							<a href="#">转发提交</a>
						</li>
						<%} %>
					<%}else{ %>
					    <%if(currentStatus.equals(2)||currentStatus.equals(3)){ %>
						<li id="s4" class="s09">
							<a href="#">完结</a>
						</li>
						<li id="s5" class="s09">
							<a href="#">重办</a>
						</li>
					    <%}else if(currentStatus.equals(0)){ %>
						<li id="s6" class="s09">
							<a href="#">删除</a>
						</li>
						<%} %>
					<%} %>	
						<li id="s7" class="s10">
							<a href="#">返回</a>
						</li>
					</ul>
				</div>
				<table width="100%" border="0" cellspacing="0" cellpadding="0"
					style="height: 93%">
					<tr>
						<td width="100%" valign="top" height="100%">
							<div class="contabwd_02">
								<table width="100%" border="0" cellspacing="0"
									style="margin-top: 8px">
									<tr>
										<td width="11%" align="right">
											标题:&nbsp;
										</td>
										<td colspan="3">
											<input name="subject" type="text" id="subject" size="93" value="<%=tdwt.getSubject()%>" readonly="readonly"/>
										</td>
									</tr>
										<tr>
											<td colspan="2">&nbsp;
											</td>
										</tr>
									<tr>
										<td width="11%" align="right">
											地点:&nbsp;
										</td>
										<td colspan="3">
											<input name="place" type="text" id="place" size="93" value="<%if(tdwt.getPlace()!=null){out.print(tdwt.getPlace());}%>" readonly="readonly"/>
										</td>
									</tr>
										<tr>
											<td colspan="2">&nbsp;
											</td>
										</tr>
									<tr>
										<td align="right" width="11%">
											开始时间:&nbsp;
										</td>
										<td width="20%">
											<input name="beginTime" type="text" id="beginTime" size="10" value="<%=sdf.format(tdwt.getBeginTime())%>" readonly="readonly"/>
										</td>
										<td align="right" width="12%">
											结束时间:&nbsp;
										</td>
										<td>
											<input name="endTime" type="text" id="endTime" size="10" value="<%=sdf.format(tdwt.getEndTime())%>" readonly="readonly"/>
										</td>
									</tr>
										<tr>
											<td colspan="2">&nbsp;
											</td>
										</tr>
									<tr>
										<td align="right">
											工作内容:&nbsp;
										</td>
										<td colspan="3">
											<textarea name=dividerTask id="dividerTask" cols="68" rows="7" readonly="readonly"><%=tdwt.getDividerTask()%></textarea>
										</td>
									</tr>
										<tr>
											<td colspan="2">&nbsp;
											</td>
										</tr>
									<tr>
										<td align="right">
											重要程度:&nbsp;
										</td>
										<td>
											<%
												if (tdwt.getImportLevel() != null) {
													int level = tdwt.getImportLevel();
													String importLevel = "";
													switch (level) {
													case 0:
														importLevel = "低级";
														break;
													case 1:
														importLevel = "中级";
														break;
													case 2:
														importLevel = "高级";
														break;
													}
											%>											
											 <input name="level" type="text" id="level" size="20" readonly="readonly" value="<%=importLevel%>" />
											 <input name="importLevel" type="hidden" id="importLevel" size="20" readonly="readonly" value="<%=tdwt.getImportLevel()%>" />
											<%
												}
											%>
										</td>
										
										<td align="right">
											当前状态:&nbsp;
										</td>
										<td>
											<%
												String status = "";
												switch (currentStatus) {
												case 0:
													status = "未查看";
													break;
												case 1:
													status = "查看";
													break;
												case 2:
													status = "办结";
													break;
												case 3:
													status = "拒绝";
													break;
												case 4:
													status = "重办";
													break;
												case 5:
													status = "完结";
													break;
												}
											%>
											<input name="status1" type="text" id="status1" size="10" readonly="readonly" value="<%=status%>" />
											<input name="currentStatus" type="hidden" id="currentStatus" size="20" value="<%=currentStatus%>" />
										</td>											
									</tr>
										<tr>
											<td colspan="2">&nbsp;
											</td>
										</tr>
									<%if("dividerUserid".equals(method)){ %>
									<tr>
										<td width="11%" align="right">
											接受人:&nbsp;
										</td>
										<td colspan="3">
											<input name="recipientUsername" type="text" id="recipientUsername" size="20" value="<%=tdwt.getRecipientUsername()%>" readonly="readonly"/>
										</td>
									</tr>
										<tr>
											<td colspan="2">&nbsp;
											</td>
										</tr>
									<%} %>
									<%if("recipientUserid".equals(method)){ %>
									<tr>
										<td width="11%" align="right">
											下发人:&nbsp;
										</td>
										<td colspan="3">
											<input name="dividerUsername" type="text" id="dividerUsername" size="20" value="<%=tdwt.getDividerUsername()%>" readonly="readonly"/>
										</td>
									</tr>
										<tr>
											<td colspan="2">&nbsp;
											</td>
										</tr>
									<%} %>
					                <%if(currentStatus.equals(2)||currentStatus.equals(3)||currentStatus.equals(4)||currentStatus.equals(5)){ %>
									<tr>
										<td align="right" width="11%">
											办结时间:&nbsp;
										</td>
										<td colspan="3">
											<input name="feedbackTime" type="text" id="feedbackTime" size="20" readonly="readonly" value="<%if(tdwt.getFeedbackTime()!= null){out.print(sdf.format(tdwt.getFeedbackTime()));}%>" />
										</td>
									</tr>
										<tr>
											<td colspan="2">&nbsp;
											</td>
										</tr>
									<tr>
										<td align="right">
											办结情况:&nbsp;
										</td>
										<td colspan="3" align="left">
											<textarea name="recipientFeedback" id="recipientFeedback" cols="68" rows="4" <%if(!currentStatus.equals(4)){out.print("readonly='readonly'");} %>><%if (tdwt.getRecipientFeedback() != null) {out.print(tdwt.getRecipientFeedback());}%></textarea>
										</td>
									</tr>
										<tr>
											<td colspan="2">&nbsp;
											</td>
										</tr>
                                    <%}%>
                                    <%if(currentStatus.equals(1)&& "recipientUserid".equals(method)){ %>
									<tr>
										<td align="right">
											办结情况:&nbsp;
										</td>
										<td colspan="3" align="left">
											<textarea name="recipientFeedback" id="recipientFeedback" cols="68" rows="4"></textarea>
										</td>
									</tr>
										<tr>
											<td colspan="2">&nbsp;
											</td>
										</tr>
									<%}%>
									<%if(currentStatus.equals(4)||currentStatus.equals(5)){ %>	
									<tr>
										<td align="right">
											意见时间:&nbsp;
										</td>
										<td>
											<input name="opinionTime" type="text" id="opinionTime" size="20" readonly="readonly" value="<%if(tdwt.getOpinionTime()!= null){out.print(sdf.format(tdwt.getOpinionTime()));}%>" />
										</td>
									</tr>
										<tr>
											<td colspan="2">&nbsp;
											</td>
										</tr>
									<tr>
										<td align="right">
											意见:&nbsp;
										</td>
										<td colspan="3">
											<textarea name="dividerOpinion1" id="dividerOpinion1" cols="68" rows="5" readonly="readonly"><%if(tdwt.getOpinionTime()!=null){out.print(tdwt.getDividerOpinion());}%></textarea>
										</td>
									</tr>
										<tr>
											<td colspan="2">&nbsp;
											</td>
										</tr>
									<%}%>
									<%if((currentStatus.equals(2)||currentStatus.equals(3))&& "dividerUserid".equals(method)){ %>
									<tr>
										<td align="right">
											意见:&nbsp;
										</td>
										<td colspan="3">
											<textarea name="dividerOpinion" id="dividerOpinion" cols="68" rows="5"></textarea>
										</td>
									</tr>
										<tr>
											<td colspan="2">&nbsp;
											</td>
										</tr>
								    <%}%>
									<tr id="turn" style="display: none">
										<td align="right" width="11%">
											接收人:
										</td>
										<td colspan="5">
											<input name="recipientUsername" type="text" id="recipientUsername" size="35" readonly="readonly"/>
											<input type="hidden" name="recipientUserid" id="recipientUserid" />
											<input type="hidden" name="recipientDeptid" id="recipientDeptid" />
											<a href="javascript:void(0)" onclick="selectusercheckwinshow('recipientUserid','recipientUsername','recipientDeptid')"><img src="<%=basePath %>images/yhglgd.gif" /></a>
										</td>
									</tr>
								</table>
							</div>
						</td>
					</tr>
				</table>

			</div>
		<input type="hidden" id="basePath" value="<%=basePath%>" />
		<input type="hidden" id="method" name="method" value="<%=method%>" />
		<input type="hidden" id="status" name="status" value="" />
		</form>
	</body>
</html>
